package 强化训练;

import java.util.Scanner;
import java.util.Stack;

public class day37数据库连接池 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = Integer.parseInt(sc.nextLine());
            String[] strs = new String[n];
            for(int i = 0 ; i < n ;i ++){
                strs[i] = sc.nextLine();
            }
            //全部输入完成
            Stack<Character> stack = new Stack<>();
            int count = 0;
            int max = 0;
            for(int i = 0; i < strs.length-1 ; i ++){
                String[] s = strs[i].split(" ");

                if("connect".equals(s[1])){
                    count++;
                    stack.push(s[0].charAt(0));
                }else{
                    stack.pop();
                    count--;
                }
                if(count > max){
                    max = count;
                }
            }
            System.out.println(max);
        }
    }
}
